select perso.matricule, nom, prenom, nosecu,  poste.codposte, poste.libposte, min(post.datpla)
as mindate, max(post.datpla) as maxdate, count(*) as compteur
from perso
inner join postpla post on post.matricule = perso.matricule
inner join poste on poste.codposte = post.codposte 
having  MIN(post.datpla) >= '01-12-2013'
group by perso.matricule, nom, prenom, nosecu, poste.libposte,poste.codposte
order by nom, mindate;

select perso.matricule, nom, prenom, nosecu,  Gtimpana.codimp, Gtimpana.codimp, min(post.datpla)
as mindate, max(post.datpla) as maxdate, count(*) as compteur
from perso
inner join postpla post on post.matricule = perso.matricule
inner join Gtimpana on Gtimpana.codimp = post.codposte 
having  MIN(post.datpla) >= '01-12-2013'
group by perso.matricule, nom, prenom, nosecu, Gtimpana.codimp,Gtimpana.codimp
order by nom, mindate;


select perso.matricule, nom, prenom, nosecu,  poste.codposte, poste.libposte, min(post.datpla)
as mindate, max(post.datpla) as maxdate, count(*) as compteur
from perso
inner join postpla post on post.matricule = perso.matricule
inner join poste on poste.codposte = post.codposte 
having  MIN(post.datpla) >= '01-12-2013'
group by perso.matricule, nom, prenom, nosecu, poste.libposte,poste.codposte
order by nom, mindate;
select codposte, libposte from poste where libposte ='DAMAGE GALCIER';
select * from Gtimpana where codimp = 'TS_DOS_ROND';

SELECT MATRICULE,
  NOM,
  PRENOM,
  ADRESS1,
  ADRESS2,
  CODPOS,
  COMMUNE,
  TELEPHONE,
  GENRE,
  SITFAM,
  NBENFANT,
  DATNAIS,
  DPTNAIS,
  LIEUNAIS,
  NATIO,
  CODNATIO,
  NOSECU,
  CODNIV1,
  CODNIV2,
  CODNIV3,
  CODNIV4,
  CODSTA,
  CODSTA2,
  CODEMP,
  GRADE,
  ECHELON,
  INDICE,
  CODCAT,
  CODMAJ,
  DATMAJ,
  DATENT1,
  DATENT2,
  DATENT3,
  DATOUT,
  CODMTF,
  TYPCONTRAT,
  DUREECONTRAT,
  DATFINCONTRAT,
  CODCAL,
  POINTAGE,
  BADGE,
  VERSION,
  TRM##1,
  TRM##2,
  TRM##3,
  TRM##4,
  TRM##5,
  TRM##6,
  TRM##7,
  TRM##8,
  TRM##9,
  TRM##10,
  TRM##11,
  TRM##12,
  TRM##13,
  TRM##14,
  TRM##15,
  TRM##16,
  TRM##17,
  TRM##18,
  TRM##19,
  TRM##20,
  TRM##21,
  TRM##22,
  TRM##23,
  TRM##24,
  TRM##25,
  TRM##26,
  TRM##27,
  TRM##28,
  TRM##29,
  TRM##30,
  FLACCES,
  CODPROFIL,
  CODACCES,
  FLGTAO,
  GTMODE,
  CODECRET,
  CODTPS,
  REGIME,
  H_SEM,
  H_MOIS,
  NB_MOIS_SAL,
  NBJ_DROIT_CP,
  MT_DROIT_CP,
  MT_PRIS_CP,
  MT_PRIS_CPA,
  RAZ_CP,
  TAUX_CP_DU,
  BASE_CP,
  BASE_MOIS_SUP,
  BASE_HEURE,
  BASE_ANC_MINIMA,
  MOYEN_COMMISSION,
  NB_HT_AN,
  NB_TRENTIEME,
  QTE_PRESENCE,
  EMP_MULTIPLE,
  RUB_SS,
  DERNIER_BULLETIN,
  DATE_DERN_BULL,
  COD_CONV,
  TAUX_ANC,
  CUMUL_1200H,
  TIT_CP,
  NOM_BQUE,
  COD_BQUE,
  COD_GUICH,
  NUM_CPTE1,
  NUM_CPTE2,
  ADR_BQUE,
  MODE_REGL_SAL,
  FL_REPART,
  CODQUAL,
  JEUNEFILLE,
  CODGRPREF,
  TXGUERRE,
  CODACCTRAV,
  TXACCTRAV,
  CARTSEJOUR,
  EDIT_CP,
  H_JOUR,
  H_CONTRAT,
  ZONE1,
  ZONE2,
  ZONE3,
  ZONE4,
  ZONE5,
  DATGTT,
  DATDERANO,
  DATDERTRT,
  DATDERIMP,
  DATVALBDG,
  DATDERMODIF,
  EMAIL,
  CODLEGIS,
  SECTORG,
  SECTANA,
  MATORIGINE
FROM PERSO order by nom;


SELECT NOM,PRENOM,perso.MATRICULE,libimp, min(date_)as mindate, max(date_) as maxdate, count(*) as compteur, datent1,datout
FROM GTIMPPLA anapla
INNER JOIN perso on anapla.matricule = perso.matricule
INNER JOIN gtimpana anapos on anapla.codimp_1 = anapos.codimp
having  min(date_) >= '01-10-2014'
GROUP BY NOM,PRENOM,perso.MATRICULE,libimp,datent1,datout
order by nom, prenom;


select perso.matricule, NOM,PRENOM, libimp, count(*) 
FROM GTIMPPLA anapla
INNER JOIN perso on anapla.matricule = perso.matricule
INNER JOIN gtimpana anapos on anapla.codimp_1 = anapos.codimp
where date_ >= '01/10/2014'
GROUP BY perso.matricule, nom, prenom, libimp
order by nom, prenom
;